<template>
    <el-dialog class="dialog" :destroy-on-close="true" title="设置" :visible.sync="isShow" :close-on-click-modal="false"
        @close="onDialogClose">
        <el-form ref="form" label-width="auto" class="form" :model="formData" :rules="rules">
            <el-form-item label="梯控端口" prop="port_num">
                <el-input :readonly="isEdit" v-model="formData.port_num" maxlength="32"></el-input>
            </el-form-item>
            <el-form-item label="梯控楼层" prop="port_floor">
                <el-input v-model="formData.port_floor" maxlength="32"></el-input>
            </el-form-item>
            <el-form-item label="楼层名称" prop="remark">
                <el-input v-model="formData.remark" maxlength="30"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="onDialogClose">取消</el-button>
            <el-button type="primary" @click="onSubmit">确认</el-button>
        </div>
    </el-dialog>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { Action } from "vuex-class";
import { mixinDialogForm } from "@/mixin/dialog/Form";
@Component({
    mixins: [mixinDialogForm]
})
export default class ladderConfEdit extends Vue {

    // 编辑
    @Action("equipmentLadder/portSet") itemEdit: any;
    editInit(data: any) {
        const me = this as any;
        me.formData = Object.assign({}, me.formData, data);
    }
    // 表单数据
    formData: any = {
        remark: "",
        port_floor: "",
        port_num: ''
    };

    /**
     * 校验配置
     *
     * @type {*}
     * @memberof mixinViewRules
     */
    rules: any = {
        port_num: [
            {
                required: true,
                message: "请选择梯控端口",
                trigger: "blur"
            }
        ],
        port_floor: [
            {
                required: true,
                message: "请输入梯控楼层",
                trigger: "blur"
            }
        ]

    };
}
</script>
